function isInstance(left, right) {
    if (!left) {
        return false;
    }
    left = left.__proto__;
    right = right.prototype;
    while (left) {
        if (left === right) {
            return true;
        }
        left = left.__proto__;
    }
    return false;
}

function Parent() { }
function Child() { }
Child.prototype = new Parent();
var child = new Child();
console.log(child instanceof Child);//true 
console.log(child instanceof Parent);//true
console.log(false instanceof Boolean);
console.log('' instanceof String);
console.log(Object instanceof Function);
console.log(Function instanceof Object);

console.log('----');

console.log(isInstance(child, Child));
console.log(isInstance(child, Parent));
console.log(isInstance(false, Boolean));
console.log(isInstance('', Boolean));
console.log(isInstance(Object, Function));
console.log(isInstance(Function, Object));
